<template>
  <div class="details">
    <div class="tou">
      <i class="iconfont icon-shouye" @click="$router.push('/category')"></i>
      <h2 class="list_title">网易严选</h2>
      <i class="iconfont icon-gouwuche"></i>
      <i class="iconfont icon-sousuo"></i>
    </div>
    <div class="middle">
      <p class="rotation_chart">
        <img
          src="	https://img1.baidu.com/it/u=413643897,2296924942&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1683219600&t=a94c05512acc61f575f36ed79e05eed8"
          alt=""
        />
      </p>
      <div class="price" v-if="product_details.banner">
        <p class="preferential" v-if="product_details.banner.processBanner">
          {{ product_details.banner.processBanner.title }}
        </p>
        <p class="commodity_price">
          <span class="commodity_price_1"
            >￥<span class="current_price">{{
              product_details.price.basicPrice
            }}</span></span
          >
          <span class="original_price" v-if="product_details.price.counterPrice"
            ><s>￥{{ product_details.price.counterPrice }}</s></span
          >
          <span class="original_price_1" v-else>
            {{ product_details.price.finalPrice.prefix }}￥{{
              product_details.price.finalPrice.price
            }}>
          </span>
        </p>
      </div>
      <div class="price_1" v-else>
        <p class="total_price">
          <span class="total_price_1"
            >￥<span class="total_price_2">{{
              product_details.price.basicPrice
            }}</span></span
          >
        </p>
      </div>
      <div class="first">
        <div class="pingjia" v-if="product_details.goodCmtRate">
          <p class="pingjia_left">
            <span class="pingjia_left_to">
              {{ product_details.goodCmtRate }}
            </span>
            <span class="pingjia_left_wei">好评率</span>
          </p>
          <span>></span>
        </div>
        <div class="member" v-if="product_details.spmcBanner">
          <span class="member_span1"><i>Pro</i></span>
          <span class="member_span2">
            {{ product_details.spmcBanner.spmcDesc }}
            <span class="member_price">
              ￥{{ product_details.spmcBanner.spmcPrice }}
            </span>
          </span>
          <span class="member_span3">{{
            product_details.spmcBanner.btnDesc
          }}</span>
        </div>
        <h2 class="details_title">{{ product_details.name }}</h2>
        <p class="business">
          <span class="business_span1">自营</span>
          <span class="business_span2">
            <img :src="product_details.simpleBrandInfo.logoUrl" alt="" />
          </span>
          <span class="business_span3">{{
            product_details.simpleBrandInfo.title
          }}</span>
        </p>
        <p class="tuijian">推荐理由</p>
        <ul class="recommended_reason">
          <li
            v-for="(item, index) in product_details.recommendReason"
            :key="index"
          >
            {{ item }}
          </li>
        </ul>
      </div>
      <div class="second">
        <p class="postage">
          <span class="postage_span1"
            >{{ product_details.skuFreight.title }}:
            {{ product_details.skuFreight.freightInfo }}</span
          >
          <span class="postage_span2">></span>
        </p>
        <p class="shopping_return">
          <span class="shopping_return_span1"
            >{{ product_details.shoppingReward.name }}:
            {{ product_details.shoppingReward.rewardDesc }}
            <span class="shopping_return_jifen">
              {{ product_details.shoppingReward.rewardValue }}
            </span>
          </span>
          <span class="shopping_return_span2">></span>
        </p>
      </div>
      <ul class="third">
        <li class="time">
          <span>请选择规格说明</span>
          <span>></span>
        </li>
        <li class="time">
          <span>限制：{{ product_details.itemLimit }}</span>
          <span>></span>
        </li>
        <li class="time">
          <span>配送：<span class="peison">请选择配送地址</span></span>
          <span>></span>
        </li>
        <li class="service">
          <span class="service_tou">
            <span>服务:</span>
            <li
              class="service_span"
              v-for="(item, index) in service"
              :key="index + 'aa'"
            >
              {{ item.title }}
            </li>
          </span>
          <span>></span>
        </li>
      </ul>
      <div class="fourth"></div>

      <!-- 第五 -->
      <div class="fifth">
        <div class="fifth_left">
          <img :src="product_details.brandInfo.picUrl" alt="" />
        </div>
        <div class="fifth_right">
          <p class="fifth_title">
            <span class="fifth_title_span1">{{
              product_details.brandInfo.title
            }}</span>
            <span>></span>
          </p>
          <p class="fifth_details">
            {{ product_details.brandInfo.desc }}
          </p>
        </div>
      </div>
      <!-- 第六 -->
      <div class="sixth">
        <p class="parameter">商品参数</p>
        <div
          class="detailed_parameters"
          v-for="(item, index) in product_details.attrList"
          :key="index"
        >
          <p class="detailed_parameters_theme">{{ item.attrName }}</p>
          <p class="detailed_parameters_explain">{{ item.attrValue }}</p>
        </div>
      </div>
      <!-- 第七渲染图 -->
      <div
        class="rendering_img"
        v-html="product_details.itemDetail.detailHtml"
      ></div>
      <div class="problem">
        <div class="problem_title">
          <p>——常见问题——</p>
        </div>
        <div
          class="neiron"
          v-for="(item, index) in product_details.issueList"
          :key="index"
        >
          <h2 class="neiron_title">{{ item.question }}</h2>
          <p class="neiron_details">
            {{ item.answer }}
          </p>
        </div>
      </div>
    </div>

    <div class="footing">
      <p class="kefu"><i class="iconfont icon-kefu"></i></p>
      <button class="purchase">立即购买</button>
      <button class="increase">加入购物车</button>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      product_details: [],
      service: [],
    };
  },
  created() {
    axios
      .get(
        `/item/detail.json?__timestamp=1683047144391&id=${this.$route.params.id}`
      )

      .then((response) => {
        this.product_details = response.data.item;
        // console.log(response.data.item, "55555");
        this.service = response.data.policyList;
        console.log("1===>", this.product_details);
        console.log("2===>", this.service);
        // console.log(this.product_details.goodCmtRate);
      });
    // console.log(this.$route.params.id);
  },
};
</script>

<style scoped>
.details {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  bottom: 0;
  background-color: #fff;
  z-index: 10;
}
.tou {
  width: 100%;
  height: 44px;
  position: fixed;
  top: 0;
  left: 0;
  border-bottom: 1px solid #eee;
  padding-left: 10px;
  padding-right: 8px;
  box-sizing: border-box;
  margin: 0 auto;
  background-color: #fff;
  z-index: 50;
}
.icon-shouye {
  float: left;
  line-height: 44px;
  color: #666;
  font-size: 28px;
}
.list_title {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  font-weight: 500;
}
.icon-sousuo,
.icon-gouwuche {
  float: right;
  font-size: 28px;
  line-height: 44px;
  margin-left: 10px;
  color: #666;
}
.middle {
  margin-top: 45px;
  padding-bottom: 58px;
  box-sizing: border-box;
  overflow: auto;
  /* background-color: #eee; */
}
.rotation_chart {
  width: 375px;
  height: 375px;
}
.rotation_chart img {
  width: 100%;
  height: 100%;
}

.footing {
  height: 52px;
  width: 100%;
  background-color: #fff;
  position: fixed;
  bottom: 0;
  left: 0;
  box-shadow: 0px 0px 5px #454444;
}
.kefu {
  float: left;
  height: 100%;
  width: 78px;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  border-right: 1px solid #ccc;
}
.icon-kefu {
  font-size: 28px;
  color: #666;
}
.purchase,
.increase {
  height: 100%;
  width: 148px;
  font-size: 16px;
  background-color: #fff;
  color: #333;
  border: none;
  border-right: 1px solid #ccc;
}
.increase {
  background-color: red;
  color: #fff;
}
.price {
  width: 100%;
  height: 74px;
  background-color: #fa1e32;
  color: #fff;
  padding-left: 15px;
  padding-top: 8px;
  box-sizing: border-box;
}
.preferential {
  margin-bottom: 4px;
  font-size: 12px;
}
.commodity_price {
  height: 44px;
  width: 100%;
  font-size: 14px;
  font-weight: bold;
}

.commodity_price_1 .current_price {
  font-size: 24px;
}
.original_price_1 {
  color: #fa1e32;
  font-weight: bold;
  background-color: #fff;
  height: 24px;
  border-radius: 12px;
  padding: 0 5px;
}
.price_1 {
  height: 40px;
  padding-left: 15px;
  padding-top: 13px;
  box-sizing: border-box;
  color: #fa1e32;
}
.total_price {
  font-weight: bold;
  font-size: 14px;
}
.total_price_2 {
  font-size: 26px;
}

/* 第一 */
.first {
  padding: 13px 15px 18px 15px;
  box-sizing: border-box;
  background-color: #fff;
  position: relative;
}
.pingjia {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translate(0, -50%);
  width: 90px;
  height: 75px;
  /* background: aqua; */
  display: flex;
  align-items: center;
}
.pingjia_left {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: #7f7f7f;
}
.pingjia_left_to {
  color: #fa1e32;
  font-size: 14px;
  font-weight: bold;
}
.member {
  height: 40px;
  padding: 0 10px;
  box-sizing: border-box;
  margin-top: 8px;
  margin-bottom: 12px;
  background-color: rgb(255, 241, 210);
  display: flex;
  align-items: center;
  position: relative;
}
.member .member_span1 {
  font-size: 10px;
  font-family: PingFangSC-Light, helvetica, Heiti SC;
  background-color: rgb(51, 51, 51);
  height: 12px;
  border-radius: 6px;
  padding: 2px;
  box-sizing: border-box;
  color: #f3ca84;
  line-height: 10px;
  margin-right: 2px;
}
.member .member_span2 {
  height: 14px;
  font-size: 12px;
  line-height: 14px;
  font-weight: bold;
}
.member .member_price {
  color: #fa1e32;
  font-size: 14px;
}

.member .member_span3 {
  background-color: rgb(51, 51, 51);
  color: #f3ca84;
  height: 24px;
  border-radius: 12px;
  padding: 0 12px;
  box-sizing: border-box;
  position: absolute;
  right: 15px;
}
.details_title {
  font-weight: bold;
  margin-bottom: 2px;
}
.business {
  margin-top: 3px;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
}
.business_span1 {
  float: left;
  background-color: #fa1e32;
  height: 16px;
  border-radius: 8px;
  color: #fff;
  padding: 0 5px;
  box-sizing: border-box;
  font-size: 10px;
  line-height: 16px;
  margin-right: 4px;
}

.business_span2 img {
  margin-right: 4px;
  float: left;
  width: 14px;
  height: 14px;
}
.business_span3 {
  color: #7f7f7f;
  font-size: 12px;
}
.tuijian {
  color: #333;
  font-size: 12px;
  margin-top: 8px;
}
.recommended_reason {
  margin-top: 6px;
  padding: 7px 10px;
  box-sizing: border-box;
  background-color: #fafafa;
  border: 1px solid #ccc;
}
.recommended_reason li {
  color: #333;
  font-size: 12px;
}
/* 第二，第三 */
.second,
.third {
  background-color: #fff;
  border-top: 9px solid #eee;
  padding: 0 15px;
  box-sizing: border-box;
}
.postage,
.shopping_return {
  height: 52px;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #ccc;
  align-items: center;
  color: #333;
  font-size: 14px;
}
.shopping_return {
  border: none;
}
.shopping_return .shopping_return_jifen {
  color: #fa1e32;
}
.third .time {
  height: 52px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #ccc;
  color: #333;
  font-size: 14px;
}
.third .time .peison {
  color: #7f7f7f;
}
.service {
  height: 88px;
  padding-top: 12px;
  padding-bottom: 4px;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #333;
  font-size: 14px;
}
.service .dian {
  color: #fa1e32;
  padding: 5px;
  box-sizing: border-box;
}
.service_tou {
  display: flex;
  flex-wrap: wrap;
}
.service_span {
  margin-right: 20px;
  margin-bottom: 8px;
  margin-left: 20px;
  box-sizing: border-box;
  list-style-type: circle;
}
/* 第四 */
.fourth {
  height: 100px;
  width: 100%;
  background-color: aquamarine;
  border-top: 9px solid #eee;
}
/* 第五 */
.fifth {
  display: flex;
  border-top: 9px solid #eee;
}
.fifth_left {
  height: 88px;
  width: 90px;
}
.fifth_left img {
  width: 48px;
  height: 48px;
  margin-top: 20px;
  margin-left: 22px;
  margin-right: 20px;
  box-shadow: 0px 0px 1px #67656585;
}
.fifth_title {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  margin-right: 10px;
  margin-bottom: 8px;
}
.fifth_title .fifth_title_span1 {
  color: #000;
  font-weight: bold;
  font-size: 14px;
}
.fifth_details {
  color: #000;
  font-size: 12px;
}
/* 第六 */
.sixth {
  padding: 15px;
  border-top: 9px solid #eee;
}
.parameter {
  color: #333;
  padding-top: 15px;
  padding-bottom: 12px;
  font-size: 14px;
  box-sizing: border-box;
}
.detailed_parameters {
  border-top: 2px dashed #ccc;
  display: flex;
  font-size: 12px;
  padding: 5px 15px 5px 0px;
  box-sizing: border-box;
}
.detailed_parameters_theme {
  width: 74px;
  color: #999;
}
.detailed_parameters_explain {
  flex: 1;
}

/* 渲染图 */
.rendering_img {
  width: 100%;
}
.rendering_img p {
  width: 100%;
  height: 100px;
}
.rendering_img p img {
  display: block;
  width: 375px;
  height: 100px;
}

/* 问题 */
.problem {
  padding: 0px 15px 15px 15px;
  box-sizing: border-box;
}
.problem_title p {
  padding: 27px 0;
  box-sizing: border-box;
  text-align: center;
  color: #333;
}
.neiron {
  padding-bottom: 13px;
  box-sizing: border-box;
}
.neiron_title {
  padding: 0px 0px 8px 9px;
  box-sizing: border-box;
  font-size: 14px;
  color: #303030;
}
.neiron_details {
  padding-left: 8px;
  box-sizing: border-box;
  color: #787878;
  font-size: 12px;
}
</style>
